package com.mf.valid;

import com.mf.valid.validator.ValidatorEnumValue;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;

/**
 * @Author: lmf
 * @Create: 2025/5/4 13:03
 * @module
 */

@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = {ValidatorEnumValue.class})
public @interface ValidEnumValue {
    String message() default "字段值不在内范围";

    /**
     * 分组验证
     */
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
    /**
     * 要验证的枚举类型
     */
    Class<? extends Enum<?>> enumClass();
}
